/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package arbitration.logic.validator;

/**
 *
 * @author prophet
 */
public class PriceValidator implements Validator{

    public Object isValid(String value) {
        String t=new String(value);
        if(t==null){
            return null;
        }
        t=t.trim();
        t = t.replaceAll(",", ".");
        try{
            Double d=Double.parseDouble(t);
            if (d <= 0) {
                return null;
            } else {
                return d;
            }
        }catch(NumberFormatException ex){
            return null;
        }
    }

}
